-
Notifications
You must be signed in to change notification settings - Fork 3.1k
refactor: split RequestContext between server and client
#1987
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
RequestContext between server and client
Code ReviewI found 3 issues that need attention: Issue 1: Missing Migration DocumentationFile: src/mcp/shared/context.py This is a breaking change that requires migration documentation. According to CLAUDE.md:
This PR changes the type signatures of
Users with type annotations for tool/prompt/resource handlers or client callbacks will need to update their code:
Please add a section to Issue 2: Missing Docstring for Public APIFile: src/mcp/server/context.py (line 16) The new public API class According to CLAUDE.md:
Similar classes in the codebase have docstrings:
Please add a docstring to python-sdk/src/mcp/server/context.py Lines 15 to 21 in 3585b22
Issue 3: Incorrect Type SignatureFile: tests/client/test_list_roots_callback.py (line 36) The type signature The Current (incorrect): async def test_list_roots(context: Context[ServerSession], message: str):The problem: async def test_list_roots(context: Context[None], message: str):See the incorrect line here: python-sdk/tests/client/test_list_roots_callback.py Lines 35 to 37 in 3585b22
|
|
|
||
| async def default_elicitation_callback( | ||
| context: RequestContext[ClientSession, Any], # noqa: ARG001 | ||
| context: RequestContext[ClientSession], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can have a ClientRequestContext.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea true, would be nice to have both
Cute.